package com.interauto.Dao.Mapper;

import com.interauto.Dao.entity.Checktable;
import com.interauto.Dao.entity.Interinfo;
import org.apache.ibatis.annotations.*;

/**
 * 添加接口和断言相关的哈
 */
@Mapper
public interface MgInterinfoInter {

    @Insert("insert into interinfo(interfacename, intercasetype, httptype, httpmeth, httpurl, headstr, postparamtype, httpparam, checktype, caseid, updatetime, createtime, delstatus) " +
            "value (#{param.interfacename},#{param.intercasetype},#{param.httptype},#{param.httpmeth},#{param.httpurl},#{param.headstr},#{param.postparamtype},#{param.httpparam}," +
            "#{param.checktype},#{param.caseid},now(),now(),0)")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void addinterinfo(@Param(value = "param") Interinfo interinfo);


    @Insert("insert into checktable(checkinfo, autoExpectEnum, expectinfo, interid, updatetime, createtime,delstatus) value " +
            "(#{param.checkinfo},#{param.autoExpectEnum},#{param.expectinfo},#{param.interid},now(),now(),0)")
    void addcheckinfo(@Param(value = "param") Checktable checktable);


    @Update("update checktable set delstatus=1 where id=#{id}")
    void delcheckinfo(@Param(value = "id") int checktableid);

    @Update("update checktable set delstatus=1 where interid=#{id}")
    void delcheckinfotointerid(@Param(value = "id") int interid);

    @Update("update interinfo set interfacename=#{param.interfacename},intercasetype=#{param.intercasetype},httptype=#{param.httptype},httpmeth=#{param.httpmeth}," +
            "httpurl=#{param.httpurl},headstr=#{param.headstr},postparamtype=#{param.postparamtype},httpparam=#{param.httpparam},checktype=#{param.checktype}," +
            "updatetime=now() where id=#{param.id}")
    void upinterinfo(@Param(value = "param") Interinfo interinfo);

    @Update("update interinfo set delstatus=1 where id=#{id}")
    void delinterinfo(@Param(value = "id")int interinfoid);
}
